<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <img :src="imgArr[index]" alt="" style="width: 400px;">
        <br>
        <a href="javascript:void(0)" @click="left" v-show="index>0"><</a>
        <a href="javascript:void(0)" @click="right" v-show="index<imgArr.length-1">></a>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app=new Vue({
            el:"#app",
            data:{
                imgArr:[
                "./img/壁纸4.jpg" ,
                "./img/壁纸6.jpg" ,
                "./img/壁纸8.jpg" ,
                "./img/壁纸11.jpg" ,
                ],
                index:0
            },
            methods:{
                left:function(){
                    this.index--;
                },
                right:function(){
                    this.index++;
                }
            }
        })
    </script>
</body>
</html>